<div class = "main-view"><!--最外层div-->
    <div class="left-margin top-margin"><strong class="am-text-primary am-text-lg">系统角色</strong></div>
    <form class="am-form-inline left-margin top-margin" role="form">
        <div class="am-form-group">
            <label>角色名</label> <input type="text" class="am-form-field" ng-model="desc">
        </div>
        <button type="submit" class="am-btn am-btn-primary" ng-click="search()">搜索</button>
    </form>
    <br>
    <div class="am-btn-group am-btn-group-xs left-margin top-margin">
        <button type="button" class="am-btn am-btn-default" data-am-modal="{target: '#doc-modal-add', width: 700, height: 736}"><span class="am-icon-plus"></span> 新增</button>
        <button type="button" class="am-btn am-btn-default" ng-click="delete()"><span class="am-icon-trash-o"></span> 删除</button>
    </div>
    <div id = "pagination" class = "pagination"></div>
        <div class="pagination-table left-margin" id="tab_menu" style = "margin-top: 0px;">
            <form class="am-form">
                <table class="am-table-striped am-table-hover table-main">
                    <thead>
                    <tr>
                        <th class="table-check"><input type="checkbox" ng-click="allSelected()"></th>
                        <th class="table-title">角色名称</th>
                        <th class="table-title">是否有效</th>
                        <th class="table-title">备注</th>
                        <th class="table-title">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-repeat="role in roleList" id = "{{role.roleID}}">
                        <td class="table-check"><input type="checkbox" class = "item-check"></td>
                        <td>{{role.roleName}}</td>
                        <td>{{role.isValid ? "是":"否"}}</td>
                        <td>{{role.remark}}</td>
                        <td>
                            <button class="am-btn am-btn-default am-btn-xs am-text-secondary" data-am-modal="{target: '#doc-modal-{{$index}}', width: 700, height: 736}" ng-click = 'getEditMenu(role.menu,$event)'><span class="am-icon-pencil-square-o"></span> 编辑</button>
                            <!--编辑框 -->
                            <div class="am-modal am-modal-no-btn" tabindex="-1" id="doc-modal-{{$index}}">
                                <div class="am-modal-dialog">
                                    <div class="am-modal-hd border-bottom" style = "text-align: left;">角色编辑
                                        <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
                                    </div>
                                    <div class="am-modal-bd body-area">
                                        <form>
                                            <div><label>角色名</label><input type="text" class = "modal-input" ng-model="role.roleName"></div>
                                            <div><label>备注</label><input type="text" class = "modal-input" ng-model="role.remark"></div><br>
                                            <div class = "role-menu">
                                                <ul class = "role-menu-list"></ul>
                                            </div>
                                        </form>
                                    </div>
                                    <div class = "button-area border-top">
                                        <button type="button" class="am-btn am-btn-success right-margin top-margin" ng-show="true" ng-click="update(role,$index)">保存</button>
                                    </div>
                                </div>
                            </div>


                        </td>
                    </tr>
                    </tbody>
                </table>
            </form>
        </div>

        <!--<div class = "left-margin">共<span id = 'page_number'>{{pageNumber}}</span>页 <span>{{count}}条数据</span></div>-->

    <!--新增框 -->
    <div class="am-modal am-modal-no-btn" tabindex="-1" id="doc-modal-add">
        <div class="am-modal-dialog">
            <div class="am-modal-hd border-bottom" style = "text-align: left;">新增角色
                <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
            </div>
            <div class="am-modal-bd body-area">
                <form>
                    <div><label>角色名</label><input type="text" class = "modal-input" ng-model="addData.roleName"></div>
                    <div><label>备注</label><input type="text" class = "modal-input" ng-model="addData.remark"></div>

                    <div class = "role-menu">
                        <ul id = "role_menu_list"></ul>
                    </div>
                </form>
            </div>
            <div class = "button-area border-top">
                <button type="button" class="am-btn am-btn-success right-margin top-margin" ng-show="true" ng-click="add(addData)">保存</button>
            </div>
        </div>
    </div>
</div>